<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

    <ui:define name="body">

		<rich:panel rendered="#{!identity.hasRole('VISUALIZAR_INDICADORES_LER')}">
			<center>
				<h:graphicImage value="/img/logo_gold_grande.png" 
					width="500px"
					height="308px"/>
			</center>
		</rich:panel>
		
        <rich:panel rendered="#{identity.hasRole('VISUALIZAR_INDICADORES_LER')}" >
        	<f:facet name="header">Indicadores</f:facet>
        	
        	<table width="100%" >
        		<tr>
        			<td style="vertical-align: top;width: 100%;text-transform: capitalize;">
        				<fieldset>
		            		<legend>Veículos Alugados</legend>
			                <rich:dataTable value="#{homeController.listaAlugueis}"
			                	var="_alugueis"
			                	onRowMouseOver="this.style.backgroundColor='#6495ED'"
                    			onRowMouseOut="this.style.backgroundColor='#FFFFCC'"
			                	rows="10">
			                	
			                	<rich:column>
			                		<f:facet name="header">Cliente</f:facet>
			                		<h:outputText value="#{_alugueis.cliente.nome}" />
			                	</rich:column>
			                	
			                	<rich:column>
			                		<f:facet name="header">Veículo</f:facet>
			                		<h:outputText value="#{_alugueis.automovel.marca}/#{_alugueis.automovel.modelo}" />
			                	</rich:column>
			                	
			                	<rich:column>
			                		<f:facet name="header">Placa</f:facet>
			                		<h:outputText value="#{_alugueis.automovel.placaFormatada}" />
			                	</rich:column>
			                	
			                	<rich:column style="text-align: center;">
			                		<f:facet name="header">Data prevista retorno</f:facet>
			                		<h:outputText value="#{_alugueis.dataPrevistaEntrega}">
			                			<s:convertDateTime pattern="dd/MM/yyyy - HH:mm"/>
			                		</h:outputText>
			                	</rich:column>
			                </rich:dataTable>
		                </fieldset>
        			</td>
        		</tr>
        	</table>
        	<br/>
        	<table width="100%" >
        		<tr>
        			<td style="vertical-align: top;">
        				<fieldset>
		            		<legend>Próximos Agendamentos</legend>
			                <rich:dataTable value="#{homeController.listaAgendamentos}"
			                	var="_agenda"
			                	onRowMouseOver="this.style.backgroundColor='#6495ED'"
                    			onRowMouseOut="this.style.backgroundColor='#FFFFCC'"
			                	rows="10">
			                	<rich:column>
			                		<f:facet name="header">Veículo</f:facet>
			                		<h:outputText value="#{_agenda.automovel.marca}/#{_agenda.automovel.modelo}" />
			                	</rich:column>
			                	
			                	<rich:column>
			                		<f:facet name="header">Cliente</f:facet>
			                		<h:outputText value="#{_agenda.cliente.nome}" rendered="#{_agenda.cliente != null}"/>
			                	</rich:column>
			                	
			                	<rich:column style="text-align: center;">
			                		<f:facet name="header">Data de início</f:facet>
			                		<h:outputText value="#{_agenda.dataInicio}">
			                			<s:convertDateTime pattern="dd/MM/yyyy - HH:mm"/>
			                		</h:outputText>
			                	</rich:column>
			                	
			                	<rich:column style="text-align: center;">
			                		<f:facet name="header">Data de fim</f:facet>
			                		<h:outputText value="#{_agenda.dataFim}">
			                			<s:convertDateTime pattern="dd/MM/yyyy - HH:mm"/>
			                		</h:outputText>
			                	</rich:column>
			                </rich:dataTable>
		                </fieldset>
        			</td>
        		</tr>
        	</table>
        </rich:panel>

    </ui:define>
</ui:composition>
